package com.shujia.java.day7;

import java.util.Arrays;

public class Demo2 {
    public static void main(String[] args) {
        String s = " 12345 6789  ";
        // 去前后空格
        String string = s.trim();
        System.out.println(s);
        System.out.println(string);

        // 切分的操作
        String str = "313,13,45,789,123,0132,7687";
        String[] list = str.split(",");
        System.out.println(Arrays.toString(list));

        for (String ss : list) {
            System.out.print(ss + " ");
        }
        System.out.println();
        // \n
        String c = "长亭外,古道边,芳草碧连天.晚风扶,柳笛声残,夕阳山外山";

        //limit 切分 切几个  \ 反斜杠进行转义
        String[] list1 = c.split(",|.");
        for (String ss : list1) {
            System.out.print(ss + " ");
        }
    }
}
